<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <link href="/static/css/default.css" rel="stylesheet" type="text/css">
    <link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
    <link rel="stylesheet" href="/static/kindeditor/themes/default/default.css" />
    <script charset="utf-8" src="/static/kindeditor/kindeditor-min.js"></script>
    <script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
    <link rel="stylesheet" href="/static/FileUpload/css/jquery.fileupload.css" />
</head>

<body style="overflow:hidden; padding:10px;">
    <form>
        <table class="formtable" style="width:580px;">

            <tbody>

                <tr>
                    <td class="tlabel">位置</td>
                    <td>
                        <input type="text" class="forminput inputstyle1" id="title" value="{$info.title}">
                    </td>
                </tr>
                <tr>
                    <td class="tlabel">简介</td>
                    <td>
                        <input type="text" class="forminput inputstyle1" id="desc" value="{$info.desc}">
                    </td>
                </tr>
               

                <tr>
                    <td class="tlabel">摄像头编号</td>
                    <td>
                        <input type="text" class="forminput inputstyle1" id="videourl" value="{$info.videourl}">
                </tr>
               
                <tr>
                    <td class="tlabel">排序</td>
                    <td>
                        <input type="text" class="forminput inputstyle1" id="seq" value="{$info.seq}">
                </tr>
              
                    <td class="tlabel">状态</td>
                    <td>
                        <select type="text" id="state" class="select" required="required">

                            {if condition="$info.state eq 1"}
                            <option value="1" selected="selected"> 正常 </option>
                            <option value="-1"> 禁用 </option>
                            {elseif condition="$info.state eq -1"/}
                            <option value="1"> 正常 </option>
                            <option value="-1" selected="selected"> 禁用 </option>
                            {else /}
                            <option value="1"> 正常 </option>
                            <option value="-1"> 禁用 </option>
                            {/if}


                        </select>
                    </td>
                </tr>



            </tbody>

        </table>

        <div class="formbtn">
            <input type="button" value="保存" class="btnsave">
            <input type="button" value="取消" class="btncancel">
        </div>
        <input type="hidden" id="id" value="{$info.id}" />
        <input type="hidden" id="imgurl" value="{$info.imgurl}" />
        <input type="hidden" id="mid" value="{$mid}" />
    </form>
  

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/vue2.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script src="/static/My97DatePicker/WdatePicker.js"></script>
<script src="/static/FileUpload/js/vendor/jquery.ui.widget.js"></script>
<script src="/static/FileUpload/js/jquery.iframe-transport.js"></script>
<script src="/static/FileUpload/js/jquery.fileupload.js"></script>
<script>
 var vue = new Vue({
        el: '#classid',
        data: {
			checked:"{$info.classid}",
            list: []
        },
        methods: {
            getdata: function () {
                var _self = this;//保存this的指向
			
                $.get('/Index/Myclass/GetMyClassList', function (data) {
                    _self.list = data;
                });
            }

        },
        created: function () {  //初始化事件里边去调用查询方法
            this.getdata();
        }
    });
    $(function () {

        $('#fileupload').fileupload({
            autoUpload: true,//是否自动上传
            url: "/index/Home/upload",
            dataType: 'json',
            done: function (e, data) {

                console.log(data.result);
                if (data.result == "") {
                    layer.msg("上传出错了!");
                } else {

                    $("#showpic").html("<img width='50px' src='/static/uploads/" + data.result + "' />");
                    $("#imgurl").val(data.result);


                }
            },
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                    'width',
                    progress + '%'
                );
            }
        }).prop('disabled', !$.support.fileInput)
            .parent().addClass($.support.fileInput ? undefined : 'disabled');



        $(".btnsave").click(function () {

            var id = $("#id").val();
            var title = $("#title").val();
            var desc = $("#desc").val();
            var videourl = $("#videourl").val();
            var seq = $("#seq").val();
            var state = $("#state").val();
            
            
            
            if(title==""){
                layer.msg("请输入位置");
                return;
            }
            
            if(videourl==""){
                layer.msg("请输入摄像头编号");
                return;
            }
            var imgurl="";
            var stime="";
            var etime="";
            var classid="";
            var mid= $("#mid").val();

            $.post("/super/mechanism/videoadd2", { "id": id, "title": title, "videourl": videourl, "desc": desc, "seq": seq, "state": state, "imgurl": imgurl,"stime":stime,
            "etime":etime,"classid":classid,mid:mid }, function (data) {
                if (data.status == 200) {
                    var index = parent.layer.getFrameIndex(window.name);
                    window.parent.iframe.contentWindow.location.reload(true);
                    console.log(window.parent.iframe);
                    parent.layer.close(index);
                } else {
                    layer.msg(data.msg);
                }
            });
        });
        $(".btncancel").click(function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
    });


</script>

</html>